package com.itheima.类加载与反射.类加载器.案例一;

import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

public class 类加载器方法一 {
    public static void main(String[] args) throws IOException {
        Properties prop = new Properties();
        ClassLoader cl = ClassLoader.getSystemClassLoader();
        InputStream inputStream = cl.getResourceAsStream("prop.properties");
        prop.load(inputStream);
        System.out.println(prop);
        inputStream.close();
        System.out.println("====================================");
        ClassLoader clp = cl.getParent();
        Properties prope1 = new Properties();
        InputStream resourceAsStream = clp.getResourceAsStream("prop.properties");
        prope1.load(resourceAsStream);
        System.out.println(prope1);
        System.out.println("====================================");
        ClassLoader clpp = clp.getParent();
        Properties prope2 = new Properties();
        InputStream resourceAsStream1 = clpp.getResourceAsStream("prop.properties");
        prope2.load(resourceAsStream1);
        System.out.println(prope2);

    }
}
